package com.flynn.rock.crm.entity.employee;

import com.flynn.rock.crm.enums.EmployeeStatus;
import com.flynn.rock.enums.customer.ReceiveStatus;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EntityListeners;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.time.LocalDateTime;

@Getter
@Setter
@Entity
@Table(name = "crm_employee")
@EntityListeners(AuditingEntityListener.class)
public class EmployeeEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "employee_id", nullable = false)
    private Long employeeId;

    @Column(name = "real_name")
    private String realName;

    @Column(name = "phone")
    private String phone;

    @Column(name = "gender")
    private String gender;

    @Column(name = "age")
    private Integer age;

    @Column(name = "user_id")
    private Long userId;

    private String userCode;

    @Column(name = "role_id")
    private Long roleId;

    @Column(name = "dept_id")
    private Long deptId;

    private Long createUserId;

    @Column(name = "status", length = 64)
    @Enumerated(EnumType.STRING)
    private EmployeeStatus status;

    @Column(name = "receive_status", length = 64)
    @Enumerated(EnumType.STRING)
    private ReceiveStatus receiveStatus;

    @Column(name = "receive_number")
    private Integer receiveNumber;

    @Column(name = "receive_priority")
    private Integer receivePriority;

    @CreatedDate
    @Column(name = "create_time")
    private LocalDateTime createTime;

    @LastModifiedDate
    @Column(name = "update_time")
    private LocalDateTime updateTime;

    @Column(name = "follow_up_number")
    private Integer followUpNumber = 0;
}
